public class LoanCalculator{
    int a;
    int m;
    double y;
    double avgCap;
    double avgInt;
    LoanCalculator(int a,int m,double y){
        this.a=a;
        this.m=m;
        this.y=y;
    }
    void avgInterest(){
        avgCap = (m+1)*a*(y/12)/2;
    }
    void avgCaption(){
        double n=Math.pow(1+(y/12),m);
        avgInt = m*a*(y/12)*n/(n-1)-a;
    }
    void print(){
        System.out.println("等额本金："+avgCap);
        System.out.println("等额本息："+avgInt);
    }
}